| Fully Qualified Name: | CodeIgniter\Database\MigrationRunner |
Class MigrationRunner
| Name | Description | Defined By |
|---|---|---|
| __construct() | Constructor. | MigrationRunner |
| clearCliMessages() | Clears any CLI messages. | MigrationRunner |
| clearHistory() | Truncates the history table. | MigrationRunner |
| ensureTable() | Ensures that we have created our migrations table in the database. | MigrationRunner |
| findMigrations() | Retrieves list of available migration scripts | MigrationRunner |
| findNamespaceMigrations() | Retrieves a list of available migration scripts for one namespace | MigrationRunner |
| force() | Migrate a single file regardless of order or batches. | MigrationRunner |
| getBatchEnd() | Returns the version number of the last migration for a batch. | MigrationRunner |
| getBatchHistory() | Returns the migration history for a single batch. | MigrationRunner |
| getBatchStart() | Returns the version number of the first migration for a batch. | MigrationRunner |
| getBatches() | Returns all the batches from the database history in order | MigrationRunner |
| getCliMessages() | Retrieves messages formatted for CLI output | MigrationRunner |
| getHistory() | Grabs the full migration history from the database for a group | MigrationRunner |
| getLastBatch() | Returns the value of the last batch in the database. | MigrationRunner |
| getObjectUid() | Uses the non-repeatable portions of a migration or history to create a sortable unique key | MigrationRunner |
| latest() | Locate and run all new migrations | MigrationRunner |
| regress() | Migrate down to a previous batch | MigrationRunner |
| setGroup() | Set database Group. | MigrationRunner |
| setName() | Set migration Name. | MigrationRunner |
| setNamespace() | Set namespace. | MigrationRunner |
| setSilent() | If $silent == true, then will not throw exceptions and will attempt to continue gracefully. | MigrationRunner |
Constructor.
When passing in $db, you may pass any of the following to connect:
| Parameter Name | Type | Description |
|---|---|---|
| $config | \BaseConfig | |
| $db | \CodeIgniter\Database\ConnectionInterface|array|string |
Returns:
Clears any CLI messages.
Returns: \MigrationRunner
Truncates the history table.
Returns: bool
Ensures that we have created our migrations table in the database.
Returns:
Retrieves list of available migration scripts
Returns: array List of all located migrations by their UID
Retrieves a list of available migration scripts for one namespace
| Parameter Name | Type | Description |
|---|---|---|
| $namespace | string | The |
Returns: array List of unsorted migrations from the namespace
Migrate a single file regardless of order or batches.
Method "up" or "down" determined by presence in history. NOTE: This is not recommended and provided mostly for testing.
| Parameter Name | Type | Description |
|---|---|---|
| $path | string | Namespace |
| $group | string|null | |
| $namespace |
Returns:
Returns the version number of the last migration for a batch.
Mostly just for tests.
| Parameter Name | Type | Description |
|---|---|---|
| $batch | int |
Returns: string
Returns the migration history for a single batch.
| Parameter Name | Type | Description |
|---|---|---|
| $batch | int | |
| $order |
Returns: array
Returns the version number of the first migration for a batch.
Mostly just for tests.
| Parameter Name | Type | Description |
|---|---|---|
| $batch | int |
Returns: string
Returns all the batches from the database history in order
Returns: array
Retrieves messages formatted for CLI output
Returns: array Current migration version
Grabs the full migration history from the database for a group
| Parameter Name | Type | Description |
|---|---|---|
| $group | string |
Returns: array
Returns the value of the last batch in the database.
Returns: int
Uses the non-repeatable portions of a migration or history to create a sortable unique key
| Parameter Name | Type | Description |
|---|---|---|
| $migration | object | or |
| $object |
Returns: string
Locate and run all new migrations
| Parameter Name | Type | Description |
|---|---|---|
| $group | string|null |
Returns:
Migrate down to a previous batch
Calls each migration step required to get to the provided batch
| Parameter Name | Type | Description |
|---|---|---|
| $targetBatch | int | Target |
| $group | string|null |
Returns: mixed Current batch number on success, FALSE on failure or no migrations are found
Set database Group.
Allows other scripts to modify on the fly as needed.
| Parameter Name | Type | Description |
|---|---|---|
| $group | string |
Returns: \MigrationRunner
Set migration Name.
| Parameter Name | Type | Description |
|---|---|---|
| $name | string |
Returns: \CodeIgniter\Database\MigrationRunner
Set namespace.
Allows other scripts to modify on the fly as needed.
| Parameter Name | Type | Description |
|---|---|---|
| $namespace | string | or |
Returns: \MigrationRunner
If $silent == true, then will not throw exceptions and will attempt to continue gracefully.
| Parameter Name | Type | Description |
|---|---|---|
| $silent | bool |
Returns: \MigrationRunner